/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * PainelMenuPrincipal.java
 *
 * Created on 23/09/2011, 19:09:10
 */
package projetointegrado;

import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Image;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.ArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.ImageIcon;

/**
 *
 * @author Emerson
 */
public class PainelMenuPrincipal extends javax.swing.JPanel {
    Materia materia, otraMateria;
    ArrayList <Materia> materias;
    Player player = new Player();
    @Override
    public void paintComponent(Graphics g) {
        Image imagem = new ImageIcon("src/Imagens/menu_inicial.jpg").getImage();
        g.drawImage(imagem, 0, 0, this);
    }
    /** Creates new form PainelMenuPrincipal */
    public PainelMenuPrincipal() {
        initComponents();
        

        labelNewGame.setBounds(450,400,200,200);
        labelNewGame.setForeground(Color.red);
        labelNewGame.setFont(new Font("Courier", Font.BOLD, 28));
        add(labelNewGame);
        labelNewGame.setVisible(true);
        
        
        labelLoadGame.setBounds(445,450,200,200);
        labelLoadGame.setForeground(Color.red);
        labelLoadGame.setFont(new Font("Courier", Font.BOLD, 28));
        add(labelLoadGame);
        labelLoadGame.setVisible(true);
        
              
        labelOptions.setBounds(470,500,200,200);
        labelOptions.setForeground(Color.red);
        labelOptions.setFont(new Font("Courier", Font.BOLD, 28));
        add(labelOptions);
        labelOptions.setVisible(true);
        
        labelMultiplayer.setBounds(470,500,200,200);
        labelMultiplayer.setForeground(Color.red);
        labelMultiplayer.setFont(new Font("Courier", Font.BOLD, 28));
        add(labelMultiplayer);
        labelMultiplayer.setVisible(true);
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        labelNewGame = new javax.swing.JLabel();
        labelLoadGame = new javax.swing.JLabel();
        labelOptions = new javax.swing.JLabel();
        labelMultiplayer = new javax.swing.JLabel();
        jLabel1 = new javax.swing.JLabel();

        setPreferredSize(new java.awt.Dimension(1024, 710));

        labelNewGame.setText("New Game");
        labelNewGame.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                labelNewGameMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                labelNewGameMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                labelNewGameMouseExited(evt);
            }
        });

        labelLoadGame.setText("Load Game");
        labelLoadGame.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                labelLoadGameMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                labelLoadGameMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                labelLoadGameMouseExited(evt);
            }
        });

        labelOptions.setText("Options");

        labelMultiplayer.setText("Multiplayer");
        labelMultiplayer.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                labelMultiplayerMouseClicked(evt);
            }
            public void mouseEntered(java.awt.event.MouseEvent evt) {
                labelMultiplayerMouseEntered(evt);
            }
            public void mouseExited(java.awt.event.MouseEvent evt) {
                labelMultiplayerMouseExited(evt);
            }
        });

        jLabel1.setText("Server");
        jLabel1.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                jLabel1MouseClicked(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
        this.setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(450, 450, 450)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(labelMultiplayer)
                    .addGroup(layout.createSequentialGroup()
                        .addComponent(labelOptions)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 425, Short.MAX_VALUE)
                        .addComponent(jLabel1)
                        .addGap(80, 80, 80))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(labelLoadGame)
                            .addComponent(labelNewGame))
                        .addContainerGap(521, Short.MAX_VALUE))))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(501, Short.MAX_VALUE)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(labelNewGame)
                        .addGap(18, 18, 18)
                        .addComponent(labelLoadGame)
                        .addGap(18, 18, 18)
                        .addComponent(labelOptions)
                        .addGap(18, 18, 18)
                        .addComponent(labelMultiplayer)
                        .addGap(99, 99, 99))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addComponent(jLabel1)
                        .addGap(119, 119, 119))))
        );
    }// </editor-fold>//GEN-END:initComponents

private void labelNewGameMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelNewGameMouseClicked
    ProjetoIntegrado.player = new Player();        
    ProjetoIntegrado.player.setMaterias();
    ProjetoIntegrado.player.setFrasesMiticas();
    ProjetoIntegrado.mb = new MapaUtfprBlocos();
    ProjetoIntegrado.pgo = new PainelGameOver();
    ProjetoIntegrado.pm = new PainelMaterias();
    ProjetoIntegrado.pi = new PainelInferior();
    ProjetoIntegrado.pv = new PainelVictory();
    ProjetoIntegrado.pi.setBounds(0,597,830,83);
    ProjetoIntegrado.mb.setVisible(true);
    ProjetoIntegrado.mb.setBounds(0,0,830,600);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.mb);
    ProjetoIntegrado.pi.setVisible(true);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pi);
    ProjetoIntegrado.pi.setBackground(Color.DARK_GRAY);
    ProjetoIntegrado.pm.setBounds(0,0,830,710);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pm);
    ProjetoIntegrado.pgo.setBounds(0,0,830,600);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pgo);
    ProjetoIntegrado.pm.setVisible(false);
    ProjetoIntegrado.pgo.setVisible(false);
    ProjetoIntegrado.pld = new PainelLateralDireto();
    ProjetoIntegrado.pld.setBounds(832, 0, 185, 680);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pld);
    ProjetoIntegrado.pld.setBackground(Color.black);
    ProjetoIntegrado.pld.setVisible(true);
    ProjetoIntegrado.pc = new PainelCasa();
    ProjetoIntegrado.pc.setVisible(false);
    ProjetoIntegrado.pc.setBounds(0,0,830,600);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pc);
   ProjetoIntegrado.pe = new PainelEnsalamento();
   ProjetoIntegrado.pe.setBounds(0,0,830,600);
   ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pe);
   ProjetoIntegrado.pe.setVisible(false);
   ProjetoIntegrado.pv.setBounds(200,200,200,200);
   ProjetoIntegrado.pv.setBackground(Color.red);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pv);
    ProjetoIntegrado.pv.setVisible(false);
    
   ProjetoIntegrado.player.diaSemana = "Segunda";
   ProjetoIntegrado.pld.setDia(ProjetoIntegrado.player.diaSemana);
    //ProjetoIntegrado.pm.setVisible(true);
    
    
    
    
   // ProjetoIntegrado.jj.requestFocus();   
    ProjetoIntegrado.mb.requestFocus();  
    this.setVisible(false);
    //ProjetoIntegrado.jj.dt.start();
    ProjetoIntegrado.player.setHp(500);
    ProjetoIntegrado.player.setHpAtual(400);
    ProjetoIntegrado.player.setMana(500);
    ProjetoIntegrado.player.setManaAtual(400);
    
    
    ProjetoIntegrado.sound.stopMidi();
    ProjetoIntegrado.sound.playMapa();

    
}//GEN-LAST:event_labelNewGameMouseClicked

private void labelNewGameMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelNewGameMouseEntered
labelNewGame.setFont(new Font("Courier", Font.BOLD, 30));
labelNewGame.setForeground(Color.white);
}//GEN-LAST:event_labelNewGameMouseEntered

private void labelNewGameMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelNewGameMouseExited
labelNewGame.setFont(new Font("Courier", Font.BOLD, 28));
labelNewGame.setForeground(Color.red);
}//GEN-LAST:event_labelNewGameMouseExited

private void labelLoadGameMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelLoadGameMouseClicked
    File arquivo = new File("playerStats.lol");
    LoadPlayer lp = new LoadPlayer();
   
   ProjetoIntegrado.player = new Player();        
    ProjetoIntegrado.player.setMaterias();
    ProjetoIntegrado.player.setFrasesMiticas();
    ProjetoIntegrado.mb = new MapaUtfprBlocos();
    ProjetoIntegrado.pgo = new PainelGameOver();
    ProjetoIntegrado.pm = new PainelMaterias();
    ProjetoIntegrado.pi = new PainelInferior();
    ProjetoIntegrado.pv = new PainelVictory();
    
    
    ProjetoIntegrado.pi.setBounds(0,597,830,83);
    ProjetoIntegrado.mb.setVisible(true);
    ProjetoIntegrado.mb.setBounds(0,0,830,600);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.mb);
    ProjetoIntegrado.pi.setVisible(true);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pi);
    ProjetoIntegrado.pi.setBackground(Color.DARK_GRAY);
    ProjetoIntegrado.pm.setBounds(0,0,830,710);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pm);
    ProjetoIntegrado.pgo.setBounds(0,0,830,600);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pgo);
    ProjetoIntegrado.pm.setVisible(false);
    ProjetoIntegrado.pgo.setVisible(false);
    ProjetoIntegrado.pld = new PainelLateralDireto();
    ProjetoIntegrado.pld.setBounds(832, 0, 185, 680);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pld);
    ProjetoIntegrado.pld.setBackground(Color.black);
    ProjetoIntegrado.pld.setVisible(true);
    ProjetoIntegrado.pc = new PainelCasa();
    ProjetoIntegrado.pc.setVisible(false);
    ProjetoIntegrado.pc.setBounds(0,0,830,600);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pc);
   ProjetoIntegrado.pe = new PainelEnsalamento();
   ProjetoIntegrado.pe.setBounds(0,0,830,600);
   ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pe);
   ProjetoIntegrado.pe.setVisible(false);
   ProjetoIntegrado.pv.setBounds(200,200,200,200);
   ProjetoIntegrado.pv.setBackground(Color.red);
    ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pv);
    ProjetoIntegrado.pv.setVisible(false);
   
   
        try {
            ProjetoIntegrado.player = (Player) lp.Load(arquivo);
        } catch (FileNotFoundException ex) {
            System.out.println("arquivo nao encontrdo");
        } catch (IOException ex) {
            System.out.println("ioexception");
        } catch (ClassNotFoundException ex) {
            System.out.println("classe nao encontrada");
        }
        ProjetoIntegrado.pld.setDia(ProjetoIntegrado.player.diaSemana);
        ProjetoIntegrado.mb.setVisible(true);
        ProjetoIntegrado.pld.setVisible(true);
    ProjetoIntegrado.pi.setVisible(true); 
    ProjetoIntegrado.mb.requestFocus();  
    this.setVisible(false);
    ProjetoIntegrado.sound.stopMidi();
    ProjetoIntegrado.sound.playMapa();
}//GEN-LAST:event_labelLoadGameMouseClicked

private void labelLoadGameMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelLoadGameMouseEntered
labelLoadGame.setFont(new Font("Courier", Font.BOLD, 30));
labelLoadGame.setForeground(Color.white);
}//GEN-LAST:event_labelLoadGameMouseEntered

private void labelLoadGameMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelLoadGameMouseExited
labelLoadGame.setFont(new Font("Courier", Font.BOLD, 28));
labelLoadGame.setForeground(Color.red);
}//GEN-LAST:event_labelLoadGameMouseExited

private void labelMultiplayerMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelMultiplayerMouseClicked
ProjetoIntegrado.pmulti = new PainelMultiplayer();
ProjetoIntegrado.pmulti.setBackground(Color.DARK_GRAY);
ProjetoIntegrado.sound.stopMidi();
ProjetoIntegrado.pmulti.setBounds(0,0,1024,710);
ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.pmulti);
ProjetoIntegrado.pmulti.setVisible(true);


this.setVisible(false);
}//GEN-LAST:event_labelMultiplayerMouseClicked

private void labelMultiplayerMouseEntered(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelMultiplayerMouseEntered
labelMultiplayer.setFont(new Font("Courier", Font.BOLD, 30));
labelMultiplayer.setForeground(Color.white);
}//GEN-LAST:event_labelMultiplayerMouseEntered

private void labelMultiplayerMouseExited(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_labelMultiplayerMouseExited
labelMultiplayer.setFont(new Font("Courier", Font.BOLD, 28));
labelMultiplayer.setForeground(Color.red);
}//GEN-LAST:event_labelMultiplayerMouseExited

private void jLabel1MouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_jLabel1MouseClicked
//        try {
//            ProjetoIntegrado.server = new Servidor();
//        } catch (IOException ex) {
//            Logger.getLogger(PainelMenuPrincipal.class.getName()).log(Level.SEVERE, null, ex);
//        }
//ProjetoIntegrado.server.setBounds(0,0,1024,710);
//ProjetoIntegrado.janelaPrincipal.add(ProjetoIntegrado.server);
//ProjetoIntegrado.server.setVisible(true);
//
//this.setVisible(false);
    ProjetoIntegrado.sound.stopMidi();
    Server s = new Server();
    s.go();
}//GEN-LAST:event_jLabel1MouseClicked

public void criaGradeDeMaterias(){

        
}



    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel labelLoadGame;
    private javax.swing.JLabel labelMultiplayer;
    private javax.swing.JLabel labelNewGame;
    private javax.swing.JLabel labelOptions;
    // End of variables declaration//GEN-END:variables
}
